/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import entities1.Invited;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author takamflore
 */
@Stateless
public class InvitedDaoImpl implements InvitedDao{
    @PersistenceContext(unitName = "meteoCal_PU")
    EntityManager em;
    List<Invited> inviteds;
    Invited invited;
    
    @Override
    public void addInvited(Invited invited){
        em.persist(invited);
    }
    @Override
   public  List<Invited> getAllEventInvited(int idEvent){
       inviteds= em.createNamedQuery("Invited.findByIdEvent").getResultList();
       return inviteds;
   }
   @Override     
  public  List<Invited> getAllMyInvitation(int idUser){
      inviteds= em.createNamedQuery("Invited.findByIdUser").getResultList();
      return inviteds;
  }
  @Override
  public void updateInvited(Invited invited){
      em.merge(invited);
      
  }
}
